package com.itheima.mall.api.oms;

import cn.hutool.core.convert.Convert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.mall.mapper.oms.OrderSettingMapper;
import com.itheima.mall.pojo.oms.OrderSetting;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;


@DubboService
public class OrderSettingServiceApiImpl implements OrderSettingServiceApi{
    @Autowired
    private OrderSettingMapper orderSettingMapper;

    @Override
    public OrderSetting findById(Integer id) {
        Long orderSettingId = Convert.toLong(id);
        return orderSettingMapper.selectById(orderSettingId);
    }

    @Override
    public void update(Integer id, OrderSetting orderSetting) {
        Long orderSettingId = Convert.toLong(id);
        LambdaQueryWrapper<OrderSetting> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(OrderSetting::getId,orderSettingId);
        orderSettingMapper.update(orderSetting,wrapper);
    }
}
